IBDAC

TCustomDAConnection.ExecSQLEx Method

Executes any SQL statement outside the TQuery or TSQL components.

Class

TCustomDAConnection

Syntax

function ExecSQLEx(const Text: string; const Params: array of variant): variant; virtual;

Parameters
Text
a SQL statement to be executed.
Params
Array of parameter values arranged in the same order as they appear in SQL statement.
Return Value
Out parameter with the name Result will hold the result of a function having data type dtString. Otherwise returns Null.

Remarks

Call the ExecSQLEx method to execute any SQL statement outside the TQuery or TSQL components. Supply the Params array with values arranged in pairs of parameter name and its value. This way each parameter name in the array is found on even index values whereas parameter value is on odd index value but right after its parameter name. The parameter pairs must be arranged according to their occurrence in a SQL statement which itself is passed in the Text string parameter.

The Params array must contain all IN and OUT parameters defined in the SQL statement. For OUT parameters provide any values of valid types so that they are explicitly defined before call to the ExecSQLEx method.

Out parameter with the name Result will hold the result of a function having data type dtString. If neither of the parameters in the Text statement is named Result, ExecSQLEx will return Null.

To get the values of OUT parameters use the ParamByName function.

Example

IBCConnection.ExecSQLEx('begin :A:= :B + :C; end;',
   ['A', 0, 'B', 5, 'C', 3]);
A:= IBCConnection.ParamByName('A').AsInteger; 

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback